import React from "react";
import {atom,useRecoilState} from "recoil";
import styleFromA from "./testa.module.css";

export const stateFromA = atom({
    key: 'stateFromA',
    default: 'stateFromA'
})


export default function TestA() {

    const [fromA, setFromA] = useRecoilState(stateFromA);
    console.log('组件A渲染了')
    return (<div className={styleFromA.container}>
        <h2>这是A组件</h2>
        <input type="text" value={fromA} onChange={(event => setFromA(event.target.value))}/>
        {fromA}

        <div>
            来自A定义Atom{}
        </div>
    </div>)
}
